package com.iussoft.receiveData.redis;

import com.iussoft.manager.RedisManagerSuper;
import com.iussoft.tools.JedisPoolFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import redis.clients.jedis.JedisPool;

/**
 * @description: 缓存接口实现
 * @author: Hou Dayu
 * @date: Created in 2020/2/24
 */
@Service("redisManager")
public class RedisManagerImpl extends RedisManagerSuper {

    @Autowired
    private Environment env;

    @Bean("jedisPool")
    public JedisPool initJedisPool() {
        JedisPoolFactory factory = new JedisPoolFactory(env);
        jedisPool = factory.getJedisPool();
        return jedisPool;
    }

    /**
     * 实例FTP相关配置
     */
    /*@Bean("ftpConfig")
    public FTPConfigProperties getFTPConfig(){
        FTPConfigProperties config = new FTPConfigProperties();
        config.setFtpUrl(env.getProperty("ftp.url"));
        config.setFtpPort(StrUtil.doNull(env.getProperty("ftp.port"),"21"));
        config.setFtpUser(env.getProperty("ftp.user"));
        config.setFtpPwd(env.getProperty("ftp.pwd"));
        config.setPrivateKey(env.getProperty("ftp.privatekey"));
        config.setFtpType(StrUtil.doNull(env.getProperty("ftp.type"),"ftp"));
        return config;
    }*/
}
